package banshee.ai;

import jp.ac.waseda.cs.washi.game.api.CharaInfo;
import jp.ac.waseda.cs.washi.game.api.MapInfo;
import jp.ac.waseda.cs.washi.gameaiarena.api.Point2;

public class MapInfoUtil
{
	private MapInfo	src;
	
	public static final int WALL = -1000000;
	

	public MapInfoUtil(MapInfo src)
	{
		this.src = src;
	}
	public int getStrength(CharaInfo charaInfo) {
		return getStrength(charaInfo, charaInfo.getLocation());
	}
	
	public int getStrength(CharaInfo charaInfo, int x, int y) {
		return getStrength(charaInfo, new Point2(x, y));
	}
	
	public int getStrength(CharaInfo charaInfo, Point2 p) {
		if(!src.isAvailable(p) || src.isWall(p)) {
			return -1000000;
		}
		CharaInfo owner =  src.getOwner(p);
		if(owner == null) {
			return 0;
		}
		if(owner == charaInfo) {
			return src.getStrength(p);
		}
		return -src.getStrength(p);
	}
}
